var osagoVehicles = 
[  
  {Kt: 1, Kbm: 1, Kn: 1, drivers: 1, power: 1, Tb1: 1980, Tb2: 2375, name: 'Легковые а/м'},
  {Kt: 1, Kbm: 1, Kn: 1, drivers: 1, power: 1, Tb1: 2965, Tb2: 2965, name: 'Легковые а/м, используемые в такси'},
  {Kt: 1, Kbm: 1, Kn: 1, drivers: 1, power: 0, Tb1: 1215, Tb2: 1215, name: 'Мотоциклы и мотороллеры'},
  {Kt: 1, Kbm: 1, Kn: 1, drivers: 1, power: 0, Tb1: 2025, Tb2: 2025, name: 'Грузовые а/м с разрешенной массой до 16 т вкл.'},
  {Kt: 1, Kbm: 1, Kn: 1, drivers: 1, power: 0, Tb1: 3240, Tb2: 3240, name: 'Грузовые а/м с разрешенной массой свыше 16 т'},
  {Kt: 1, Kbm: 1, Kn: 1, drivers: 1, power: 0, Tb1: 1620, Tb2: 1620, name: 'Автобусы с числом пассажир. мест до 20 вкл.'},
  {Kt: 1, Kbm: 1, Kn: 1, drivers: 1, power: 0, Tb1: 2025, Tb2: 2025, name: 'Автобусы с числом пассажир. мест более 20'},
  {Kt: 1, Kbm: 1, Kn: 1, drivers: 1, power: 0, Tb1: 2965, Tb2: 2965, name: 'Автобусы, используемые в такси'},
  {Kt: 1, Kbm: 1, Kn: 1, drivers: 1, power: 0, Tb1: 1010, Tb2: 1010, name: 'Трамваи'},
  {Kt: 1, Kbm: 1, Kn: 1, drivers: 1, power: 0, Tb1: 1620, Tb2: 1620, name: 'Троллейбусы'},
  {Kt: 2, Kbm: 1, Kn: 1, drivers: 1, power: 0, Tb1: 1215, Tb2: 1215, name: 'Тракторы, дорожно-строительные и иные машины'},
  {Kt: 1, Kbm: 0, Kn: 0, drivers: 0, power: 0, Tb1:  395, Tb2:  395, name: 'Прицепы к легковым авто, принадлежащим юрлицам, мотоциклам, мотороллерам '},
  {Kt: 1, Kbm: 0, Kn: 0, drivers: 0, power: 0, Tb1:  810, Tb2:  810, name: 'Прицепы к грузовым а/м, полуприцепы, прицепы-роспуски'},
  {Kt: 2, Kbm: 0, Kn: 0, drivers: 0, power: 0, Tb1:  305, Tb2:  305, name: 'Прицепы к тракторам, дор.-строит. и иным машинам'}
]
var osagoAreas=
[
  {type: 0, Kt1: 2.0, Kt2: 1.2, name: 'Москва'},
  {type: 0, Kt1: 1.7, Kt2: 1.0, name: 'города и населенные пункты Московской обл.'},
  {type: 0, Kt1: 1.8, Kt2: 1.0, name: 'Санкт-Петербург'},
  {type: 0, Kt1: 1.6, Kt2: 1.0, name: 'города и населенные пункты Ленинградской обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Абакан'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Азов'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Александров'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Алексин'},
  {type: 0, Kt1: 0.6, Kt2: 0.5, name: 'Алтайский край'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Альметьевск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Амурск'},
  {type: 0, Kt1: 0.6, Kt2: 0.5, name: 'Амурская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Анапа'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Ангарск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Анжеро-Судженск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Апатиты'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Арзамас'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Армавир'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Арсеньев'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Артем'},
  {type: 0, Kt1: 1.6, Kt2: 1.0, name: 'Архангельск'},
  {type: 0, Kt1: 0.85, Kt2: 0.5, name: 'Архангельская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Асбест'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Астрахань'},
  {type: 0, Kt1: 0.65, Kt2: 0.5, name: 'Астраханская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Ачинск'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Барнаул'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Благовещенск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Балаково'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Балахна'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Балашов'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Батайск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Белгород'},
  {type: 0, Kt1: 0.65, Kt2: 0.5, name: 'Белгородская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Белебей'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Белово'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Белогорск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Белорецк'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Белореченск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Бердск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Березники'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Березовский'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Бийск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Биробиджан'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Бор'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Борисоглебск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Боровичи'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Братск'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Брянск'},
  {type: 0, Kt1: 0.6, Kt2: 0.5, name: 'Брянская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Бугульма'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Бугуруслан'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Буденновск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Бузулук'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Буйнакск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Великие Луки'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Великий Новгород'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Верхняя Пышма'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Верхняя Салда'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Владикавказ'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Владивосток'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Владимир'},
  {type: 0, Kt1: 0.75, Kt2: 0.5, name: 'Владимирcкая обл.'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Волгоград'},
  {type: 0, Kt1: 0.6, Kt2: 0.5, name: 'Волгоградская обл.'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Волжский'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Вологда'},
  {type: 0, Kt1: 0.8, Kt2: 0.5, name: 'Вологодская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Волгодонск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Волжск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Вольск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Воркута'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Воронеж'},
  {type: 0, Kt1: 0.55, Kt2: 0.5, name: 'Воронежская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Воткинск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Выкса'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Вышний Волочек'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Вязьма'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Геленджик'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Георгиевск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Глазов'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Горно-Алтайск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Губкин'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Гуково'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Гусь-Хрустальный'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Дербент'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Дзержинск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Димитровград'},
  {type: 0, Kt1: 0.55, Kt2: 0.5, name: 'Еврейская автономная обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Ейск'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Екатеринбург'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Елабуга'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Елец'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Ессентуки'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Ефремов'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Железногорск'},
  {type: 0, Kt1: 0.55, Kt2: 0.5, name: 'Забайкальский край'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Заречный'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Заринск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Зеленогорск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Зеленодольск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Златоуст'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Иваново'},
  {type: 0, Kt1: 0.75, Kt2: 0.5, name: 'Ивановская обл.'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Ижевск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Инта'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Иркутск'},
  {type: 0, Kt1: 0.65, Kt2: 0.5, name: 'Иркутская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Искитим'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Ишим'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Ишимбай'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Йошкар-Ола'},
  {type: 0, Kt1: 0.7, Kt2: 0.5, name: 'Кабардино-Балкарская Республика'},
  {type: 0, Kt1: 1.6, Kt2: 1.0, name: 'Казань'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Калининград'},
  {type: 0, Kt1: 0.6, Kt2: 0.5, name: 'Калининградская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Калуга'},
  {type: 0, Kt1: 0.65, Kt2: 0.5, name: 'Калужская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Каменск-Уральский'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Каменск-Шахтинский'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Камышин'},
  {type: 0, Kt1: 0.65, Kt2: 0.5, name: 'Камчатский край'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Канаш'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Канск'},
  {type: 0, Kt1: 0.8, Kt2: 0.5, name: 'Карачаево-Черкесская Республика'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Каспийск'},
  {type: 0, Kt1: 1.6, Kt2: 1.0, name: 'Кемерово'},
  {type: 0, Kt1: 0.8, Kt2: 0.5, name: 'Кемеровская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Кимры'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Кинешма'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Киров'},
  {type: 0, Kt1: 0.7, Kt2: 0.5, name: 'Кировская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Кирово-Чепецк'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Киселевск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Кисловодск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Клинцы'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Ковров'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Когалым'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Комсомольск-на-Амуре'},
  {type: 0, Kt1: 1.6, Kt2: 1.0, name: 'Копейск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Кострома'},
  {type: 0, Kt1: 0.8, Kt2: 0.5, name: 'Костромская обл.'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Котлас'},
  {type: 0, Kt1: 1.6, Kt2: 1.0, name: 'Краснодар'},
  {type: 0, Kt1: 0.75, Kt2: 0.5, name: 'Краснодарский край'},
  {type: 0, Kt1: 1.6, Kt2: 1.0, name: 'Красноярск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Краснокаменск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Краснокамск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Краснотурьинск'},
  {type: 0, Kt1: 0.7, Kt2: 0.5, name: 'Красноярский край'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Кропоткин'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Крымск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Кстово'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Кузнецк'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Куйбышев'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Кумертау'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Кунгур'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Курган'},
  {type: 0, Kt1: 0.7, Kt2: 0.5, name: 'Курганская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Курганинск'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Курск'},
  {type: 0, Kt1: 0.55, Kt2: 0.5, name: 'Курская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Кызыл'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Лабинск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Лениногорск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Ленинск-Кузнецкий'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Лесной'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Лесосибирск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Ливны'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Липецк'},
  {type: 0, Kt1: 0.6, Kt2: 0.5, name: 'Липецкая обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Лиски'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Лысьва'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Магадан'},
  {type: 0, Kt1: 0.75, Kt2: 0.5, name: 'Магаданская обл.'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Магнитогорск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Майкоп'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Малгобек'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Махачкала'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Междуреченск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Мелеуз'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Миасс'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Минеральные Воды'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Минусинск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Михайловка'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Михайловск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Мичуринск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Мончегорск'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Мурманск'},
  {type: 0, Kt1: 0.85, Kt2: 0.5, name: 'Мурманская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Муром'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Мценск'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Набережные Челны'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Назарово'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Назрань'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Нальчик'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Находка'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Невинномысск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Нерюнгри'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Нефтекамск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Нефтеюганск'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Нижневартовск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Нижнекамск'},
  {type: 0, Kt1: 1.6, Kt2: 1.0, name: 'Нижний Новгород'},
  {type: 0, Kt1: 0.75, Kt2: 0.5, name: 'Нижегородская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Нижний Тагил'},
  {type: 0, Kt1: 0.65, Kt2: 0.5, name: 'Новгородская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Новоалтайск'},
  {type: 0, Kt1: 1.6, Kt2: 1.0, name: 'Новокузнецк'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Новокуйбышевск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Новомосковск'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Новороссийск'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Новосибирск'},
  {type: 0, Kt1: 0.75, Kt2: 0.5, name: 'Новосибирская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Новотроицк'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Новоуральск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Новочебоксарск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Новочеркасск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Новошахтинск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Новый Уренгой'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Норильск'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Ноябрьск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Нягань'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Обнинск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Озерск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Октябрьский'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Омск'},
  {type: 0, Kt1: 0.7, Kt2: 0.5, name: 'Омская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Орел'},
  {type: 0, Kt1: 0.6, Kt2: 0.5, name: 'Орловская обл.'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Оренбург'},
  {type: 0, Kt1: 0.7, Kt2: 0.5, name: 'Оренбургская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Орск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Осинники'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Отрадный'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Павлово'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Пенза'},
  {type: 0, Kt1: 0.6, Kt2: 0.5, name: 'Пензенская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Первоуральск'},
  {type: 0, Kt1: 1.6, Kt2: 1.0, name: 'Пермь'},
  {type: 0, Kt1: 0.85, Kt2: 0.5, name: 'Пермский край'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Петрозаводск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Петропавловск-Камчатский'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Печора'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Полевской'},
  {type: 0, Kt1: 0.6, Kt2: 0.5, name: 'Приморский край'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Прокопьевск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Прохладный'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Псков'},
  {type: 0, Kt1: 0.55, Kt2: 0.5, name: 'Псковская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Пятигорск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Ревда'},
  {type: 0, Kt1: 0.85, Kt2: 0.5, name: 'Республика Адыгея'},
  {type: 0, Kt1: 0.7, Kt2: 0.5, name: 'Республика Алтай'},
  {type: 0, Kt1: 0.75, Kt2: 0.5, name: 'Республика Башкортостан'},
  {type: 0, Kt1: 0.65, Kt2: 0.5, name: 'Республика Бурятия'},
  {type: 0, Kt1: 0.55, Kt2: 0.5, name: 'Республика Дагестан'},
  {type: 0, Kt1: 0.7, Kt2: 0.5, name: 'Республика Ингушетия'},
  {type: 0, Kt1: 0.65, Kt2: 0.5, name: 'Республика Калмыкия'},
  {type: 0, Kt1: 0.7, Kt2: 0.5, name: 'Республика Карелия'},
  {type: 0, Kt1: 0.85, Kt2: 0.5, name: 'Республика Коми'},
  {type: 0, Kt1: 0.75, Kt2: 0.5, name: 'Республика Марий Эл'},
  {type: 0, Kt1: 0.7, Kt2: 0.5, name: 'Республика Мордовия'},
  {type: 0, Kt1: 0.8, Kt2: 0.5, name: 'Республика Саха (Якутия)'},
  {type: 0, Kt1: 0.6, Kt2: 0.5, name: 'Республика Северная Осетия-Алания'},
  {type: 0, Kt1: 0.8, Kt2: 0.5, name: 'Республика Татарстан'},
  {type: 0, Kt1: 0.6, Kt2: 0.5, name: 'Республика Тыва'},
  {type: 0, Kt1: 0.6, Kt2: 0.5, name: 'Республика Хакасия'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Ржев'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Рославль'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Россошь'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Ростов-на-Дону'},
  {type: 0, Kt1: 0.65, Kt2: 0.5, name: 'Ростовская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Рубцовск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Рузаевка'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Рыбинск'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Рязань'},
  {type: 0, Kt1: 0.65, Kt2: 0.5, name: 'Рязанская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Салават'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Сальск'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Самара'},
  {type: 0, Kt1: 0.7, Kt2: 0.5, name: 'Самарская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Саранск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Сарапул'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Саратов'},
  {type: 0, Kt1: 0.6, Kt2: 0.5, name: 'Саратовская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Саров'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Сатка'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Сафоново'},
  {type: 0, Kt1: 0.75, Kt2: 0.5, name: 'Сахалинская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Саяногорск'},
  {type: 0, Kt1: 0.75, Kt2: 0.5, name: 'Свердловская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Свободный'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Северодвинск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Североморск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Северск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Серов'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Сибай'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Славянск-на-Кубани'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Смоленск'},
  {type: 0, Kt1: 0.55, Kt2: 0.5, name: 'Смоленская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Соликамск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Сочи'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Спасск-Дальний'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Ставрополь'},
  {type: 0, Kt1: 0.65, Kt2: 0.5, name: 'Ставропольский край'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Старый Оскол'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Стерлитамак'},
  {type: 0, Kt1: 1.6, Kt2: 1.0, name: 'Сургут'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Сызрань'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Сыктывкар'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Таганрог'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Талнах'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Тамбов'},
  {type: 0, Kt1: 0.65, Kt2: 0.5, name: 'Тамбовская обл.'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Тверь'},
  {type: 0, Kt1: 0.65, Kt2: 0.5, name: 'Тверская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Тимашевск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Тихорецк'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Тобольск'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Тольятти'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Томск'},
  {type: 0, Kt1: 0.7, Kt2: 0.5, name: 'Томская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Троицк (Челябинская обл.)'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Туапсе'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Туймазы'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Тула'},
  {type: 0, Kt1: 0.65, Kt2: 0.5, name: 'Тульская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Тулун'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Тюмень'},
  {type: 0, Kt1: 0.8, Kt2: 0.5, name: 'Тюменская обл.'},
  {type: 0, Kt1: 0.7, Kt2: 0.5, name: 'Удмуртская Республика'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Узловая'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Улан-Удэ'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Ульяновск'},
  {type: 0, Kt1: 0.7, Kt2: 0.5, name: 'Ульяновская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Усолье-Сибирское'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Уссурийск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Усть-Илимск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Усть-Кут'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Уфа'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Ухта'},
  {type: 0, Kt1: 1.6, Kt2: 1.0, name: 'Хабаровск'},
  {type: 0, Kt1: 0.65, Kt2: 0.5, name: 'Хабаровский край'},
  {type: 0, Kt1: 1.6, Kt2: 1.0, name: 'Ханты-Мансийск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Хасавюрт'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Чайковский'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Чапаевск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Чебаркуль'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Чебоксары'},
  {type: 0, Kt1: 1.6, Kt2: 1.0, name: 'Челябниск'},
  {type: 0, Kt1: 0.8, Kt2: 0.5, name: 'Челябинская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Черемхово'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Череповец'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Черкесск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Черногорск'},
  {type: 0, Kt1: 0.55, Kt2: 0.5, name: 'Чеченская Республика'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Чистополь'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Чита'},
  {type: 0, Kt1: 0.7, Kt2: 0.5, name: 'Чувашская Республика'},
  {type: 0, Kt1: 0.55, Kt2: 0.5, name: 'Чукотский автономный округ.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Чусовой'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Шадринск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Шахты'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Шелехов'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Шуя'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Щекино'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Элиста'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Энгельс'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Южно-Сахалинск'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Юрга'},
  {type: 0, Kt1: 1.6, Kt2: 1.0, name: 'Якутск'},
  {type: 0, Kt1: 1.3, Kt2: 0.8, name: 'Ярославль'},
  {type: 0, Kt1: 0.7, Kt2: 0.5, name: 'Ярославская обл.'},
  {type: 0, Kt1: 1.0, Kt2: 0.8, name: 'Ярцево'},
  {type: 2, Kt1: 1.6, Kt2: 1.6, name: 'Иностранное государство'},
  {type: 3, Kt1: 1.0, Kt2: 1.0, name: 'Следует к месту регистрации'}
]
var osagoPowers=
[
  {max:  50, Km: 0.6},
  {max:  70, Km: 1.0},
  {max: 100, Km: 1.1},
  {max: 120, Km: 1.2},
  {max: 150, Km: 1.4},
  {max: 999, Km: 1.6}
]
var osagoClasses=
[
  {id:  'M', c: 2.45, id0:  '0', id1: 'M', id2: 'M', id3: 'M', id4: 'M'},
  {id:  '0', c: 2.30, id0:  '1', id1: 'M', id2: 'M', id3: 'M', id4: 'M'},
  {id:  '1', c: 1.55, id0:  '2', id1: 'M', id2: 'M', id3: 'M', id4: 'M'},
  {id:  '2', c: 1.40, id0:  '3', id1: '1', id2: 'M', id3: 'M', id4: 'M'},
  {id:  '3', c: 1.00, id0:  '4', id1: '1', id2: 'M', id3: 'M', id4: 'M'},
  {id:  '4', c: 0.95, id0:  '5', id1: '2', id2: '1', id3: 'M', id4: 'M'},
  {id:  '5', c: 0.90, id0:  '6', id1: '3', id2: '1', id3: 'M', id4: 'M'},
  {id:  '6', c: 0.85, id0:  '7', id1: '4', id2: '2', id3: 'M', id4: 'M'},
  {id:  '7', c: 0.80, id0:  '8', id1: '4', id2: '2', id3: 'M', id4: 'M'},
  {id:  '8', c: 0.75, id0:  '9', id1: '5', id2: '2', id3: 'M', id4: 'M'},
  {id:  '9', c: 0.70, id0: '10', id1: '5', id2: '2', id3: '1', id4: 'M'},
  {id: '10', c: 0.65, id0: '11', id1: '6', id2: '3', id3: '1', id4: 'M'},
  {id: '11', c: 0.60, id0: '12', id1: '6', id2: '3', id3: '1', id4: 'M'},
  {id: '12', c: 0.55, id0: '13', id1: '6', id2: '3', id3: '1', id4: 'M'},
  {id: '13', c: 0.50, id0: '13', id1: '7', id2: '3', id3: '1', id4: 'M'}
]

function osagoUsageCheck()
{
    var owner = document.getElementById('osagoOwner').value;
    var area = document.getElementById('osagoArea').value;

    if (osagoAreas[area].type == 0) 
    {
        document.getElementById('osagoUsagePerson').style.display = (owner == 0) ? '' : 'none';
        document.getElementById('osagoUsageCompany').style.display = (owner == 1) ? '' : 'none';
        document.getElementById('osagoUsageNone').style.display = 'none';
    }
    else
    {
        document.getElementById('osagoUsagePerson').style.display = 'none';
        document.getElementById('osagoUsageCompany').style.display = 'none';
        document.getElementById('osagoUsageNone').style.display = '';
    }
}

function osagoDriversCheck()
{
    var owner = document.getElementById('osagoOwner').value;
    var vehicle = document.getElementById('osagoVehicle').value;
    var area = document.getElementById('osagoArea').value;
    
    if (owner == 0 && osagoVehicles[vehicle].drivers == 1 && (osagoAreas[area].type == '0' || osagoAreas[area].type == '3')) 
    {
        document.getElementById('osagoDrivers').style.display = '';
        document.getElementById('osagoDriversNone').style.display = 'none';
    }
    else 
    {
        document.getElementById('osagoDrivers').style.display = 'none';
        document.getElementById('osagoDriversNone').style.display = '';
    }
}

function osagoProlongationCheck()
{
    var vehicle = document.getElementById('osagoVehicle').value;
    var area = document.getElementById('osagoArea').value;
    var i;

    if (osagoVehicles[vehicle].Kbm == 1 && osagoAreas[area].type == '0') 
    {
        document.getElementById('osagoProlongation').style.display = '';
        document.getElementById('osagoProlongationNone').style.display = 'none';
        var p = document.getElementById('osagoProlongation').value;
        for (i = 1; i <= 8; i++)
            document.getElementById('osagoProlongationTr' + i).style.display = (i < p) ? '' : 'none';
    }
    else 
    {
        document.getElementById('osagoProlongation').style.display = 'none';
        document.getElementById('osagoProlongationNone').style.display = '';
        for (i = 1; i <= 8; i++)
            document.getElementById('osagoProlongationTr' + i).style.display = 'none';
    }
}

function osagoViolationCheck() 
{
    var vehicle = document.getElementById('osagoVehicle').value;
    var area = document.getElementById('osagoArea').value;
    var prolongation = document.getElementById('osagoProlongation').value;

    if (osagoVehicles[vehicle].Kn == 1 && osagoAreas[area].type == '0' && prolongation > 1) 
    {
        document.getElementById('osagoViolationTr').style.display = '';
        document.getElementById('osagoViolation').style.display = '';
        document.getElementById('osagoViolationNone').style.display = 'none';
    }
    else 
    {
        document.getElementById('osagoViolationTr').style.display = 'none';
        document.getElementById('osagoViolation').style.display = 'none';
        document.getElementById('osagoViolationNone').style.display = '';
    }
}

function osagoOwnerChange()
{
    osagoUsageCheck();
    osagoDriversCheck();
}

function osagoAreaChange()
{
    var area = document.getElementById('osagoArea').value;
    var areaType = osagoAreas[area].type;
    document.getElementById('osagoPeriod').style.display = (areaType == 1 || areaType == 2) ? '' : 'none';
    document.getElementById('osagoPeriodRussia').style.display = (areaType == 0) ? '' : 'none';
    document.getElementById('osagoPeriodForeign').style.display = (areaType == 1 || areaType == 2) ? '' : 'none';
    document.getElementById('osagoPeriodMoving').style.display = (areaType == 3) ? '' : 'none';
    osagoUsageCheck();
    osagoDriversCheck();
    osagoProlongationCheck();
    osagoViolationCheck();
}

function osagoVehicleChange()
{
  var vehicle=document.getElementById('osagoVehicle').value;
  var vehiclePower=osagoVehicles[vehicle].power;
  document.getElementById('osagoPower').style.display=(vehiclePower==1) ? '' : 'none';
  document.getElementById('osagoPowerNone').style.display=(vehiclePower==0) ? '' : 'none';
  osagoDriversCheck();
  osagoProlongationCheck();
  osagoViolationCheck();
}

function osagoProlongationChange()
{
  osagoProlongationCheck();
  osagoViolationCheck();
}

function osagoLoad()
{
    var i, o;

    o = document.getElementById('osagoVehicle');
    for (i = 0; i < osagoVehicles.length; i++)
        SelectOptionAdd(o, osagoVehicles[i].name, i);

    o = document.getElementById('osagoArea');
    for (i = 0; i < osagoAreas.length; i++)
        SelectOptionAdd(o, osagoAreas[i].name, i, (osagoAreas[i].Kt1 > 1 || osagoAreas[i].type > 0) ? 'bld' : '');

    osagoVehicleChange();
    osagoAreaChange();
    osagoCalc();
}

function osagoCalc()
{
  var Tb,Kt,Kbm,Kvs,Ko,Km,Kp,Ks,Kn;
  var c,o,i,n,v;
  var owner=document.getElementById('osagoOwner').value;
  var area=document.getElementById('osagoArea').value;
  document.getElementById('mesto_registracii').value=getSelectedText(document.getElementById('osagoArea'));
  var vehicle=document.getElementById('osagoVehicle').value;
  document.getElementById('tip_ts').value=getSelectedText(document.getElementById('osagoVehicle'));
	document.getElementById('moshnost_dvig').value=getSelectedText(document.getElementById('osagoPower'));


  if (owner==0)
    Tb=osagoVehicles[vehicle].Tb1;
  else
    Tb=osagoVehicles[vehicle].Tb2;
  if (osagoVehicles[vehicle].Kt==1)
    Kt=osagoAreas[area].Kt1;
  else
    Kt=osagoAreas[area].Kt2;
  if (document.getElementById('osagoPeriodRussia').style.display=='') {
    o=document.getElementById('osagoPeriodRussia');
	document.getElementById('srok_dogovora').value="1 год";
  }
  else
    if (document.getElementById('osagoPeriodForeign').style.display==''){
      o=document.getElementById('osagoPeriodForeign');
	  document.getElementById('srok_dogovora').value=getSelectedText(o);

	} else
      o=document.getElementById('osagoPeriodMoving');
  Kp=o.value*1;
  if (document.getElementById('osagoUsagePerson').style.display==''){
    o=document.getElementById('osagoUsagePerson');
	document.getElementById('period_polzovania').value=getSelectedText(o);
  }
  else
    if (document.getElementById('osagoUsageCompany').style.display=='')
      o=document.getElementById('osagoUsageCompany');
    else
      o=document.getElementById('osagoUsageNone');
  Ks=o.value*1;

  if (document.getElementById('osagoPower').style.display==''){
    o=document.getElementById('osagoPower');
  }
  else
    o=document.getElementById('osagoPowerNone');
  Km=o.value*1;
  if (document.getElementById('osagoDrivers').style.display==''){
    o=document.getElementById('osagoDrivers');
	  document.getElementById('vozrast_stazh').value=getSelectedText(o);
  }
  else
    o=document.getElementById('osagoDriversNone');
  Kvs=o.value*1;
  if (Kvs==0 && osagoVehicles[vehicle].drivers==1)
  {
    switch(osagoAreas[area].type)
    {
      case 0: // РФ
        Ko=1.8;
        Kvs=1.0;
        break;
      case 1: // Украина
        Ko=1.0;
        Kvs=1.0;
        break;
      case 2: // иные государства
        if (owner==0)
        {
          Ko=1.0;
          Kvs=1.5;
        }
        else
        {
          Ko=1.8;
          Kvs=1.0;
        }
        break;
      case 3: // следование к месту регистрации
        Ko=1.7;
        Kvs=1.0;
        break;
    }
  }
  else
  {
    Ko=1.0;
    if (Kvs==0) Kvs=1.0;
  }
  if (document.getElementById('osagoProlongation').style.display=='')
  {
	document.getElementById('dogovor_zakl').value=getSelectedText(document.getElementById('osagoProlongation'));
    v=document.getElementById('osagoProlongation').value;
    c='3';
    for (i=1;i<=v-1;i++)
    {
      n=document.getElementById('osagoProlongation'+i).value;
      j=osagoClasses.indexOfField('id',c);
      c=osagoClasses[j]['id'+n];
    }
    j=osagoClasses.indexOfField('id',c);
    Kbm=osagoClasses[j].c;
  }
  else
    Kbm=1.0;
  if (document.getElementById('osagoViolation').style.display==''){
    o=document.getElementById('osagoViolation');
	  document.getElementById('narushenia').value=getSelectedText(o);
  }
  else
    o=document.getElementById('osagoViolationNone');
  Kn=o.value*1;
 
  var p=Tb*Kt*Kbm*Kvs*Ko*Km*Kp*Ks*Kn;
  p=Math.round(p*100)/100;
  if (Kn==1)
  {
    if (p>3*Tb*Kt) p=3*Tb*Kt;
  }
  else
  {
    if (p>5*Tb*Kt) p=5*Tb*Kt;
  }
  var s=p.toString().replace('.',',');
  var n=s.indexOf(',');
  if (n==-1)
    s+=','+'00';
  else
    if (n==s.length-2)
      s+='0';
  document.getElementById('osagoPremiumValue').innerHTML= '<b>' + s + '</b>';
  document.getElementById('cena_osago').value=s;
}

String.prototype.rtrim=function()
{
	var r=/\s+$/g;
	return this.replace(r,'');
}

function SelectOptionAdd(o,t,v,c)
{
  if (o.options)
  {
    var oOption=document.createElement("OPTION");
    oOption.text=t;
    if (c!='')
      oOption.className=c;
    oOption.value=v;
    o.options.add(oOption);
  }
}

Date.prototype.dateobj2str=function()
{
  var y=this.getFullYear();
  var m=this.getMonth()+1;
  var d=this.getDate();
  var h=this.getHours();
  var n=this.getMinutes();
  var s=this.getSeconds();
  return ((d<10)?('0'+d):(d))+'.'+((m<10)?('0'+m):(m))+'.'+y+' '+((h<10)?('0'+h):(h))+':'+((n<10)?('0'+n):(n))+':'+((s<10)?('0'+s):(s));
}

Array.prototype.indexOfField = function(field, value) 
{
    var i;
    var n = -1;

    for (i = 0; i < this.length; i++) 
    {
        if (this[i][field] == value) 
        {
            n = i;
            break;
        }
    }
    return n;
}

function getSelectedText(selectArea) 
{
    op = selectArea.options;
    for (i = 0; i < op.length; i++) 
    {
        if (op[i].selected) 
		{
		    return op[i].text;
			break;
		}
	}	
}